/*
 * MainWindow.h
 *
 *  Created on: 11.04.2010
 *      Author: king
 */

#ifndef MAINWINDOW_H_
#define MAINWINDOW_H_

#include "db/SqliteDataSource.h"
#include "db/DataSourceManager.h"
#include "ui_MainWindow.h"
#include "AddPersonDialog.h"
#include "TreeLoadDialog.h"
#include "FindDialog.h"

namespace etu {
namespace ui {

using etu::db::DataSource;
using etu::db::SqliteDataSource;
using etu::db::DataSourceManager;

class CMainWindow: public QMainWindow, protected Ui::MainWindow
{
    Q_OBJECT

    CAddPersonDialog* m_addDialog;
    CTreeLoadDialog* m_dialog;
    CFindDialog* m_findDialog;
    DataSource* m_dataSource;

    std::vector<QAction*> m_actions;
    std::string m_treeName;

    void saveTreeToDB(std::string name);
    std::string getTreeName();

public:
    CMainWindow();

private slots:

    void saveTree();
    void saveTreeAs();
    void loadTree();
    void deleteTree();
    void exportTree();
    void importTree();
    void deleteTreeFromDB(std::string name);
    void loadTreeFromDB(std::string name);
    void setEnableStatus(bool flag);
    void showAboutView();
    void revertTree();

};

}
}

#endif /* MAINWINDOW_H_ */
